<template>
    <div class="allweather">
        <WeatherItem v-for="(weather,index) in weathers" :key="index" :weather="weather">
        </WeatherItem>
    </div>
</template>
<script>
  import axios from 'axios';

  import WeatherItem from '../base/weatherItem';
    export default {
      data() {
          return {
            weathers:[],
          }
      },
      created(){
        this.getWeathers();

      },
      methods: {
        async getWeathers(){
          let weathers = await axios.get('/weather');
          this.weathers = weathers.data;
          console.log('前端获取数据',this.weathers)
        }
      },
      computed: {},
      components: {
        WeatherItem,
      }
    }
</script>
<style scoped lang="less">
  .allweather{
    display: flex;
    flex-wrap: wrap;
    justify-content: center;

  }
</style>
